/**
 * \file XMLAttribute.h
 * \brief XMLAttribute declaration class
 * \author Edouard ROGE
 * \date 16 October 2012
 */

#ifndef _XML_ATTRIBUTE_
#define _XML_ATTRIBUTE_

#include "Core/Memory/HeapObject.h"

namespace Core
{
	namespace File
	{
		/**
		 * \class XMLAttribute
		 * \brief Xml attribute contains a variable (identified by its name) and a value
		 */
		class XMLAttribute : public Memory::HeapObject
		{
		public:

			/**
			 * \fn XMLAttribute();
			 * \brief Default constructor
			 */
			XMLAttribute();

			/**
			 * \fn XMLAttribute(const std::string & _strName, const std::string & _strValue);
			 * \param _strName name
			 * \param _strValue value
			 * \brief Constructor
			 */
			XMLAttribute(const std::string & _strName, const std::string & _strValue);

			/**
			 * \fn virtual ~XMLAttribute();
			 * \brief Destructor
			 */
			virtual ~XMLAttribute();

			/**
			 * \fn void SetName(const std::string & _name);
			 * \param _name new name of the attribute
			 * \brief Set the attribute name
			 */
			void SetName(const std::string & _name);

			/**
			 * \fn const std::string & GetName() const;
			 * \return the name of the attribute
			 * \brief Get the attribute name
			 */
			const std::string & GetName() const;

			/**
			 * template <class T> void SetValue(const T & _value);
			 * \param _value new value for the attribute
			 * \brief Set the value of the attribute
			 */
			template <class T> void SetValue(const T & _value);

			/**
			 * \fn void SetValue(const uint32 & _value);
			 * \param _value new value for the attribute
			 * \brief Set the integer value of the attribute
			 */
			//void SetValue(const uint32 & _value);

			/**
			 * \fn void SetValue(const float & _value);
			 * \param _value new value for the attribute
			 * \brief Set the float value of the attribute
			 */
			//void SetValue(const float & _value);

			/**
			 * \fn void SetValue(const std::string & _value);
			 * \param _value new value for the attribute
			 * \brief Set the string value of the attribute
			 */
			//void SetValue(const std::string & _value);

			/**
			 * \fn error GetValue(uint32 & _value) const;
			 * \param _value look up the value as an integer
			 * \return errOK if everything went ok
			 * \brief Get the integer value of the attribute
			 */
			error GetValue(uint32 & _value) const;

			/**
			 * \fn error GetValue(float & _value) const;
			 * \param _value look up the value as an float
			 * \return errOK if everything went ok
			 * \brief Get the float value of the attribute
			 */
			error GetValue(float & _value) const;

			/**
			 * \fn error GetValue(std::string & _value) const;
			 * \param _value look up the value as an String
			 * \return errOK if everything went ok
			 * \brief Get the String value of the attribute
			 */
			error GetValue(std::string & _value) const;

			/**
			 * \fn const std::string & GetStringValue() const;
			 * \return string value
			 * \brief Get the String value of the attribute
			 */
			const std::string & GetStringValue() const;

		private:

			/** attribute name */
			std::string m_strAttributeName;

			/** attribute value */
			std::string m_strAttributeValue;
		};
	}
}

#endif // _XML_ATTRIBUTE_
